<script lang="ts" setup>
import axios from 'axios';
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
interface BookDetails{
    id:string,
    name:string,
    type:string
}
let route=useRoute()
let detailsData=ref<BookDetails|null>(null)
onMounted(async()=>{

        let res=await axios.get("http://localhost:8080/api/books/"+route.query.id)
        detailsData.value=res.data
    }
)
</script>
<template>
    <h1>书籍详情</h1>
    <div v-if="detailsData">
        <h2>id:{{ detailsData.id }}</h2>
        <h2>name:{{ detailsData.name }}</h2>
        <h2>type:{{ detailsData.type }}</h2>
    </div>
   
</template>
<style scoped>

</style>